make gbversion.h, setup.iss generated files. (#806)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Sun, 2 Jan 2022 19:22:11 +0000 (12:22 -0700)
committerGitHub <noreply@github.com>
Sun, 2 Jan 2022 19:22:11 +0000 (12:22 -0700)
* make gbversion.h, setup.iss generated files.

add cmake documentation targets.

* work on check.

* simplify parameter passing to test scripts.

* cmake test work.

run vtesto in parallel.
fix valgrind decision making in testo.
fix test for gpsbabel executable with blanks in path.

* update vtesto for cmake.

* simplify option passing for testo.

* simplify valgrind detection in testo.

* fix testo bug.

* add ubuntu cmake build.

* fix workflow

* align gui pro and CMakeLists.

and use target properties

27 files changed:
.github/workflows/ubuntu.yml
.gitignore
CMakeLists.txt
GPSBabel.pro
gbversion.cmake [new file with mode: 0644]
gbversion.h [deleted file]
gbversion.h.in
gbversion.pri [new file with mode: 0644]
gui/.gitignore
gui/CMakeLists.txt
gui/app.pro
gui/app.rc
gui/mainwindow.cc
gui/setup.iss [deleted file]
gui/setup.iss.in
gui/setup.iss.qmake.in
gui/upgrade.cc
testo
testo.d/track-discard.test
testo.d/validate.test
testo.d/xol.test
tools/.gitignore
tools/build_and_test_cmake [new file with mode: 0755]
tools/make_gpsbabel_org_wrapper.sh.in [new file with mode: 0755]
tools/make_windows_release.ps1
vtesto
win32/gpsbabel.rc

index 3b2edc22d174a16e34cdc9182561850f1b041742..b4ecbf5ab4c5f7383dd7b1c028d86196c9ddf301 100644 (file)
@@ -26,6 +26,22 @@ jobs:
       run: |
         ./build_and_test
 
+  cmake:
+    name: cmake Build
+    runs-on: ubuntu-latest
+    container:
+      image: gpsbabel-docker.jfrog.io/tsteven4/gpsbabel_build_environment_focal
+      env:
+        LC_ALL: 'C.UTF-8'
+
+    steps:
+    - name: Checkout repository
+      uses: actions/checkout@v2
+
+    - name: build_and_test
+      run: |
+        ./tools/build_and_test_cmake
+
   qtio_gcc:
     name: qtio gcc Build
     runs-on: ubuntu-latest
index bf6fddde492fe69bf8c992962305c3742302eade..957c3cac4b2f6b3d2a2e848af0c3fa70e49873b5 100644 (file)
@@ -40,3 +40,5 @@ CMakeFiles/
 /autogen/
 /makedoc
 /empty
+/gbversion.h
+/qrc_gpsbabel.cpp
index 5d5868ac215f8b4aeefd5c5bf20e4eaa17ec1969..fa6d0dfaff9af5b601d1b074a96fc8403f036be9 100644 (file)
@@ -1,6 +1,8 @@
 cmake_minimum_required(VERSION 3.11)
 
-project(gpsbabel LANGUAGES C CXX)
+include(gbversion.cmake)
+configure_file(gbversion.h.in gbversion.h @ONLY NEWLINE_STYLE LF)
+project(gpsbabel LANGUAGES C CXX VERSION ${GB.VERSION})
 
 set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED True)
@@ -422,6 +424,56 @@ get_target_property(IncDirs gpsbabel INCLUDE_DIRECTORIES)
 message(STATUS "Include Directores are: \"${IncDirs}\"")
 
 if(UNIX)
-  # the tests only work if the pwd is top level source dir due to the file name getting embedded in the file nonexistent.err.
-  add_custom_target(check cd ${CMAKE_SOURCE_DIR}\; PNAME=${CMAKE_BINARY_DIR}/gpsbabel ./testo DEPENDS gpsbabel)
+  # This test only works if the pwd is top level source dir due to the
+  # file name getting embedded in the file nonexistent.err.
+  add_custom_target(check
+                    ${CMAKE_SOURCE_DIR}/testo -p $<TARGET_FILE:gpsbabel>
+                    DEPENDS gpsbabel
+                    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+                    VERBATIM)
+endif()
+if(UNIX AND NOT APPLE)
+  # This test only works if the pwd is top level source dir due to the
+  #file name getting embedded in the file nonexistent.err.
+  file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/testo.d)
+  add_custom_target(check-vtesto
+                    find testo.d -maxdepth 1 -name "*.test" -print0 | xargs -0 basename -s .test | sort |
+                    xargs -n 1 -P 3 -I TESTNAME ${CMAKE_SOURCE_DIR}/vtesto
+                    -l -j ${CMAKE_BINARY_DIR}/testo.d/TESTNAME.vglog -p $<TARGET_FILE:gpsbabel> TESTNAME
+                    DEPENDS gpsbabel
+                    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+                    VERBATIM)
+endif()
+
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
+  set(WEB "../babelweb" CACHE PATH "Path where the documentation will be stored for www.gpsbabel.org.")
+  # If using a makefile generator WEB can be overridden on the make
+  # command line, e.g.  make gpsbabel.org WEB=/tmp.  If not overridden on
+  # the make command line, or not using a makefile generator, or if using
+  # "cmake --build dir --target gpsbabel.org", then the cache variable
+  # WEB will be used.  The cache variable can be overridden in the usual
+  # way when configuring, i.e. "cmake dir -DWEB:PATH=/tmp".
+
+  # FIXME: Is overriding WEB on the make command line worth the trouble of
+  # using configure_file to build a wrapper script?
+
+  configure_file(${CMAKE_SOURCE_DIR}/tools/make_gpsbabel_org_wrapper.sh.in
+                 ${CMAKE_BINARY_DIR}/tools/make_gpsbabel_org_wrapper.sh
+                 @ONLY
+                 NEWLINE_STYLE LF)
+  add_custom_target(gpsbabel.org
+                    ${CMAKE_BINARY_DIR}/tools/make_gpsbabel_org_wrapper.sh
+                    DEPENDS gpsbabel gpsbabel.pdf)
+endif()
+
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
+  add_custom_target(gpsbabel.html
+                    ${CMAKE_SOURCE_DIR}/tools/make_gpsbabel_html.sh
+                    DEPENDS gpsbabel)
+endif()
+
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
+  add_custom_target(gpsbabel.pdf
+                    ${CMAKE_SOURCE_DIR}/tools/make_gpsbabel_pdf.sh
+                    DEPENDS gpsbabel)
 endif()
index a1b29a38b5b167e2ad1348819eb4551ccb2ccb5e..dfb828529cc504ec3ca56d4e675bc389b16ec587 100644 (file)
@@ -1,5 +1,5 @@
 # Enforce minimum Qt version.
-# versionAtLeast() was introduced in Qt 5.10, so we can't count on it being available.
+# versionAtLeast() was introduced in Qt 5.10, so we cannot count on it being available.
 MIN_QT_VERSION = 5.12 # major[.minor[.patch]]
 MIN_QT_VERSION_COMPONENTS = $$split(MIN_QT_VERSION, .)
 MIN_QT_VERSION_MAJOR = $$member(MIN_QT_VERSION_COMPONENTS, 0)
@@ -16,8 +16,11 @@ if(equals(QT_MAJOR_VERSION, $$MIN_QT_VERSION_MAJOR):equals(QT_MINOR_VERSION, $$M
 QT -= gui
 versionAtLeast(QT_VERSION, 6.0): QT += core5compat
 
+# set VERSION related variables and generate gbversion.h
+include(gbversion.pri)
+
 TARGET = gpsbabel
-VERSION = 1.7.0
+VERSION = $$GB.VERSION
 
 CONFIG += console
 CONFIG -= app_bundle
@@ -26,35 +29,6 @@ CONFIG += link_pkgconfig
 
 TEMPLATE = app
 
-# use GB variable to express ownership intention and
-# avoid conflict with documented and undocumented qmake variables
-GB.VERSION_COMPONENTS = $$split(VERSION, .)
-GB.MAJOR = $$member(GB.VERSION_COMPONENTS, 0)
-GB.MINOR = $$member(GB.VERSION_COMPONENTS, 1)
-GB.MICRO = $$member(GB.VERSION_COMPONENTS, 2)
-# Increase GB.BUILD for a new release (why? Where is this ever used?)
-# A: it's used by win32/gpsbabel.rc which includes gbversion.h
-GB.BUILD = 31
-# GB.PACKAGE_RELEASE = "-beta20190413"
-
-# may be overwridden on qmake command line
-!defined(DOCVERSION, var) {
-  DOCVERSION=$${VERSION}
-}
-
-# may be overwridden on qmake command line
-!defined(WEB, var) {
-  WEB = ../babelweb
-}
-
-# use undocumented QMAKE_SUBSTITUTES variable to emulate AC_CONFIG_FILES
-GB.versionfile.input = gbversion.h.qmake.in
-GB.versionfile.output = gbversion.h
-QMAKE_SUBSTITUTES += GB.versionfile
-GB.setupfile.input = gui/setup.iss.qmake.in
-GB.setupfile.output = gui/setup.iss
-QMAKE_SUBSTITUTES += GB.setupfile
-
 # RESOURCES
 RESOURCES = gpsbabel.qrc
 
@@ -420,9 +394,14 @@ QMAKE_EXTRA_TARGETS += cppcheck
 
 gpsbabel.org.depends = gpsbabel gpsbabel.pdf FORCE
 equals(PWD, $${OUT_PWD}) {
+  # may be overridden on qmake command line
+  !defined(WEB, var) {
+    WEB = ../babelweb
+  }
+  # Allow WEB to be overridden when running make.
+  # DOCVERSION must be overridden at qmake time as it also affects the object code.
   gpsbabel.org.commands += web=\$\${WEB:-$${WEB}};
-  gpsbabel.org.commands += docversion=\$\${DOCVERSION:-$${DOCVERSION}};
-  gpsbabel.org.commands += tools/make_gpsbabel_org.sh \"\$\${web}\" \"\$\${docversion}\";
+  gpsbabel.org.commands += tools/make_gpsbabel_org.sh \"\$\${web}\" $$shell_quote($$DOCVERSION);
 } else {
   gpsbabel.org.commands += echo "target gpsbabel.org is not supported for out of source builds.";
   gpsbabel.org.commands += exit 1;
diff --git a/gbversion.cmake b/gbversion.cmake
new file mode 100644 (file)
index 0000000..0195e42
--- /dev/null
@@ -0,0 +1,30 @@
+# Use GB variable to express ownership intention and avoid conflict with
+# documented and undocumented cmake variables.
+
+# Until we do a hierarchical build the build directory for gpsbabel and
+# the build directory for GPSBabelFE are independent.  Only the source
+# directories have a known relationship.  Including this pri file from the
+# source tree will generate the version file in the current build directory.
+
+# Note some of these variables are also used in the gui to generate setup.iss.
+# Note some of these variables are also used in the cli to generate documents.
+
+# FIXME: when we have a hierarchical build we can set the version directly
+# in the top level CMakeLists.txt file, and the version components will
+# be automatically available in as variables.  But today we have multiple
+# independent CMakeLists.txt files all with their own project commands.
+# By defining the version here we minimize the number of locations
+# containing the definition to gbversion.pri and gbversion.cmake.
+
+set(GB.VERSION 1.7.0) # also change in gbversion.pri
+string(REPLACE "." ";" VERSION_COMPONENTS ${GB.VERSION})
+list(GET VERSION_COMPONENTS 0 GB.MAJOR)
+list(GET VERSION_COMPONENTS 1 GB.MINOR)
+list(GET VERSION_COMPONENTS 2 GB.MICRO)
+# Increase GB.BUILD for a new release (why? Where is this ever used?)
+# A: it's used by win32/gpsbabel.rc which includes gbversion.h
+set(GB.BUILD 31 CACHE STRING "Fourth component of Windows VERSIONINFO resource FILEVERSION and PRODUCTVERSION parameters.")
+set(GB.PACKAGE_RELEASE "" CACHE STRING "String to append to VERSION tuple.") # .e.g. "-beta20190413"
+
+# may be overridden on cmake command line
+set(DOCVERSION ${GB.VERSION} CACHE STRING "String appended to documentation location for www.gpsbabel.org.")
diff --git a/gbversion.h b/gbversion.h
deleted file mode 100644 (file)
index baac2f4..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * gbversion.h is generated from gbversion.h.in which uses autoconf voodoo
- * to get the version number from configure.ac.
- *
- * Isn't simplification via automation grand?
- */
-#ifdef RC_INVOKED
-// These defines are for the Microsoft resource compiler scripts
-// win32/gpsbabel.rc and gui/app.rc
-#define VER_FILE 1,7,0,31
-#define VER_PRODUCT 1,7,0,31
-#define VER_FILE_STR "1.7.0"
-#define VER_PRODUCT_STR  "1.7.0"
-#else
-#define VERSION "1.7.0"
-#define WEB_DOC_DIR "https://www.gpsbabel.org/htmldoc-1.7.0"
-#endif
index 6e8c7e3099a220eba76c18f1de67c5401eb7a0d3..4778bfb39f0c299b6e32a65858cdc6223dcec99d 100644 (file)
@@ -7,11 +7,11 @@
 #ifdef RC_INVOKED
 // These defines are for the Microsoft resource compiler scripts
 // win32/gpsbabel.rc and gui/app.rc
-#define VER_FILE @GBMAJOR@,@GBMINOR@,@GBMICRO@,@GBBUILD@
-#define VER_PRODUCT @GBMAJOR@,@GBMINOR@,@GBMICRO@,@GBBUILD@
-#define VER_FILE_STR "@GBMAJOR@.@GBMINOR@.@GBMICRO@@PACKAGE_RELEASE@"
-#define VER_PRODUCT_STR  "@GBMAJOR@.@GBMINOR@.@GBMICRO@@PACKAGE_RELEASE@"
+#define VER_FILE @GB.MAJOR@,@GB.MINOR@,@GB.MICRO@,@GB.BUILD@
+#define VER_PRODUCT @GB.MAJOR@,@GB.MINOR@,@GB.MICRO@,@GB.BUILD@
+#define VER_FILE_STR "@GB.MAJOR@.@GB.MINOR@.@GB.MICRO@@GB.PACKAGE_RELEASE@"
+#define VER_PRODUCT_STR  "@GB.MAJOR@.@GB.MINOR@.@GB.MICRO@@GB.PACKAGE_RELEASE@"
 #else
-#define VERSION "@GBMAJOR@.@GBMINOR@.@GBMICRO@@PACKAGE_RELEASE@"
+#define VERSION "@GB.MAJOR@.@GB.MINOR@.@GB.MICRO@@GB.PACKAGE_RELEASE@"
 #define WEB_DOC_DIR "https://www.gpsbabel.org/htmldoc-@DOCVERSION@"
 #endif
diff --git a/gbversion.pri b/gbversion.pri
new file mode 100644 (file)
index 0000000..9967e97
--- /dev/null
@@ -0,0 +1,36 @@
+# Use GB variable to express ownership intention and avoid conflict with
+# documented and undocumented qmake variables.
+
+# Until we do a hierarchical build the build directory for gpsbabel and
+# the build directory for GPSBabelFE are independent.  Only the source
+# directories have a known relationship.  Including this pri file from the
+# source tree will generate the version file in the current build directory.
+
+# Note some of these variables are also used in the gui to generate setup.iss.
+# Note some of these variables are also used in the cli to generate documents.
+
+# FIXME: Today we have multiple independent .pro files.  By defining
+# the version here we minimize the number of locations containing the
+# definition to gbversion.pri and gbversion.cmake. When we retire qmake
+# we will be back to only one place for version to be defined.
+
+GB.VERSION = 1.7.0 # Also change in gbversion.cmake
+GB.VERSION_COMPONENTS = $$split(GB.VERSION, .)
+GB.MAJOR = $$member(GB.VERSION_COMPONENTS, 0)
+GB.MINOR = $$member(GB.VERSION_COMPONENTS, 1)
+GB.MICRO = $$member(GB.VERSION_COMPONENTS, 2)
+# Increase GB.BUILD for a new release (why? Where is this ever used?)
+# A: it's used by win32/gpsbabel.rc which includes gbversion.h
+GB.BUILD = 31
+# GB.PACKAGE_RELEASE = "-beta20190413"
+
+# may be overridden on qmake command line
+!defined(DOCVERSION, var) {
+DOCVERSION=$${GB.VERSION}
+}
+
+# use undocumented QMAKE_SUBSTITUTES variable to emulate AC_CONFIG_FILES
+# Note $${PWD} is relative to the location of this file.
+GB.versionfile.input = $${PWD}/gbversion.h.qmake.in
+GB.versionfile.output = gbversion.h
+QMAKE_SUBSTITUTES += GB.versionfile
index c98deaa4bc558f89ab89fa819e43c12336b2e7eb..91b4294fedba11f0638ea29ce4773541681ded8f 100644 (file)
@@ -8,3 +8,5 @@
 /tmp/
 /release/
 /debug/
+/gbversion.h
+/setup.iss
index a4d16a10630d7d46ce731b9d208ff11690b097b1..bc62bc5af0fa11a17bf6a5eca978627f1f161e51 100644 (file)
@@ -1,6 +1,9 @@
 cmake_minimum_required(VERSION 3.11)
 
-project(gpsbabelfe LANGUAGES CXX)
+include(../gbversion.cmake)
+configure_file(../gbversion.h.in gbversion.h @ONLY NEWLINE_STYLE LF)
+configure_file(setup.iss.in setup.iss @ONLY NEWLINE_STYLE CRLF)
+project(gpsbabelfe LANGUAGES CXX VERSION ${GB.VERSION})
 
 set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED True)
@@ -16,7 +19,6 @@ set(CMAKE_AUTORCC ON)
 
 if(UNIX AND NOT APPLE)
   set(TARGET gpsbabelfe)
-  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY GPSBabelFE)
 else()
   set(TARGET GPSBabelFE)
 endif()
@@ -41,8 +43,12 @@ else()
   target_compile_definitions(${TARGET} PRIVATE DISABLE_MAPPREVIEW)
 endif()
 
-list(APPEND RESOURCES app.qrc)
+if(UNIX AND NOT APPLE)
+  set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY GPSBabelFE)
+endif()
 
+# RESOURCES
+list(APPEND RESOURCES app.qrc)
 if(WIN32)
   list(APPEND RESOURCES app.rc)
 endif()
index a0357fb736e992d7437025675050b6cf5ac61e9a..81385bf5bc200971fa6b5fc8a6e50d27aa0fd494 100755 (executable)
@@ -1,6 +1,15 @@
 # $Id: app.pro,v 1.19 2010-11-01 03:30:42 robertl Exp $
 #
 
+# set VERSION related variables and generate gbversion.h
+include(../gbversion.pri)
+
+GB.setupfile.input = setup.iss.qmake.in
+GB.setupfile.output = setup.iss
+QMAKE_SUBSTITUTES += GB.setupfile
+
+VERSION = $$GB.VERSION
+
 #CONFIG += qt causes link failure on msvc.  Qt6EntryPoint.lib not added to libs.
 CONFIG(debug, debug|release) {
   CONFIG += console
@@ -30,21 +39,23 @@ mac:DESTDIR = .
 
 UI_DIR = tmp
 
-RESOURCES = app.qrc
-RC_FILE = app.rc
-
-win32 {
+unix:!mac{
+  TARGET=gpsbabelfe
+} else {
   TARGET=GPSBabelFE
 }
+
 win32-g++ {
   QMAKE_LFLAGS_RELEASE += -static-libgcc
 }
-unix:TARGET=gpsbabelfe
-mac:TARGET=GPSBabelFE
 
 # Set QMAKE_TARGET_BUNDLE_PREFIX so we get the correct CFBundleIdentifier in Info.plist
 darwin:QMAKE_TARGET_BUNDLE_PREFIX=org.gpsbabel
 
+# RESOURCES
+RESOURCES = app.qrc
+RC_FILE = app.rc
+
 # FORMS
 FORMS += aboutui.ui
 FORMS += advui.ui
@@ -156,4 +167,3 @@ macx|linux{
   QMAKE_EXTRA_TARGETS += compile_command_database
   QMAKE_DISTCLEAN += compile_commands.json
 }
-
index b53f3749993e3abccf9442a1048cfd4ce2b52e16..a949054d3d012b05e0c7fe199fb1f8da654be14d 100644 (file)
@@ -1,5 +1,5 @@
 #include <winver.h>
-#include "../gbversion.h"
+#include "gbversion.h"
 
 IDI_ICON1               ICON                    "images/appicon.ico"
 
index 8ff9b058c66fdd0e6f77ede37434f8c438c2fed6..d4b153b50828d16ccca10775f78d25d0e1d366c8 100644 (file)
@@ -58,7 +58,7 @@
 #include <cstdlib>                     // for exit
 
 #include "mainwindow.h"
-#include "../gbversion.h"              // for VERSION
+#include "gbversion.h"                 // for VERSION
 #include "aboutdlg.h"                  // for AboutDlg
 #include "advdlg.h"                    // for AdvDlg
 #include "appname.h"                   // for appName
diff --git a/gui/setup.iss b/gui/setup.iss
deleted file mode 100644 (file)
index e82a5fb..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-;\r
-; NOTE: setup.iss is generated from setup.iss.in via configure.\r
-; The generated setup.iss is checked in to help keep the version numbers\r
-; synchronized.\r
-;\r
-; Script for generating installation setup program for GPSBabel\r
-; Uses the Inno setup compiler.\r
-; windeployqt should be run to prepare the necessary Qt files before\r
-; running Inno Setup.\r
-#ifndef package_dir\r
-  #define package_dir "..\build-app-Desktop-Release\package"\r
-#endif\r
-\r
-[Setup]\r
-; NOTE: The value of AppId uniquely identifies this application.\r
-; Do not use the same AppId value in installers for other applications.\r
-; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)\r
-AppId={{1B8FE958-A304-4902-BF7A-4E2F0F5B7017}\r
-AppName=GPSBabel\r
-AppVerName=GPSBabel 1.7.0\r
-AppPublisher=GPSBabel\r
-AppPublisherURL=https://www.gpsbabel.org\r
-AppSupportURL=https://www.gpsbabel.org\r
-AppUpdatesURL=https://www.gpsbabel.org\r
-ArchitecturesAllowed=x64\r
-ArchitecturesInstallIn64BitMode=x64\r
-DefaultDirName={pf}\GPSBabel\r
-DefaultGroupName=GPSBabel\r
-OutputDir=release\r
-OutputBaseFilename=GPSBabel-1.7.0-Setup\r
-OutputManifestFile=GPSBabel-1.7.0-Manifest.txt\r
-SetupIconFile=images\babel2.ico\r
-Compression=lzma\r
-SolidCompression=yes\r
-LicenseFile=COPYING.txt\r
-\r
-[Languages]\r
-Name: "english"; MessagesFile: "compiler:Default.isl"\r
-\r
-[Tasks]\r
-Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked\r
-\r
-[Files]\r
-Source: gmapbase.html;                         DestDir: "{app}"; Flags: ignoreversion\r
-Source: qt.conf;                               DestDir: "{app}"; Flags: ignoreversion\r
-\r
-Source: "{#package_dir}\*"; Excludes: "vc_redist.*.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs\r
-Source: "{#package_dir}\vc_redist.x86.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall\r
-Source: "{#package_dir}\vc_redist.x64.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall\r
-Source: "{#package_dir}\gpsbabel.exe";         DestDir: "{app}"; Flags: ignoreversion\r
-; Source: release\help\*;              DestDir: "{app}\help"; Flags: ignoreversion recursesubdirs createallsubdirs\r
-\r
-; Translation strings extracted from source code.  Include it in the dist\r
-; so that users can translate if they want to.\r
-; Source: gpsbabel_*.ts;               DestDir: "{app}\translations"; Flags: ignoreversion\r
-; Source: gpsbabelfe_*.ts;             DestDir: "{app}\translations"; Flags: ignoreversion\r
-\r
-; Compiled translation strings that are used at runtime.\r
-Source: coretool\gpsbabel_*.qm;        DestDir: "{app}\translations"; Flags: ignoreversion\r
-Source: gpsbabelfe_*.qm;               DestDir: "{app}\translations"; Flags: ignoreversion\r
-\r
-; Miscellaneous\r
-Source: COPYING.txt;                   DestDir: {app}; Flags: ignoreversion\r
-; Source: AUTHORS;                     DestDir: {app}; Flags: ignoreversion\r
-; Source: README.contrib;                      DestDir: {app}; Flags: ignoreversion\r
-; Source: README.gui;                  DestDir: {app}; Flags: ignoreversion\r
-\r
-\r
-; NOTE: Don't use "Flags: ignoreversion" on any shared system files\r
-\r
-[Icons]\r
-Name: "{group}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe"\r
-Name: "{commondesktop}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe"; Tasks: desktopicon\r
-\r
-[Run]\r
-Filename: "{app}\vc_redist.x86.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist\r
-Filename: "{app}\vc_redist.x64.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist\r
-Filename: "{app}\gpsbabelfe.exe"; Description: "{cm:LaunchProgram,GPSBabelFE}"; Flags: nowait postinstall skipifsilent\r
-\r
-[Registry]\r
-Root: HKCU; Subkey: "Software\GPSBabel"; Flags: uninsdeletekeyifempty\r
-Root: HKCU; Subkey: "Software\GPSBabel\GPSBabel"; Flags: uninsdeletekey\r
-Root: HKCU; Subkey: "Software\GPSBabel\GPSBabelFE"; Flags: uninsdeletekey\r
-\r
-; ISPP preprocessor output can be useful for debug\r
-#expr SaveToFile("PreprocessedScript.iss")\r
index 09560192dbd26c621f55838842faae2cc1e1d7bf..6074353ba599fda0f3620e72aa2a7e6ada39a134 100644 (file)
@@ -10,6 +10,9 @@
 #ifndef package_dir\r
   #define package_dir "..\build-app-Desktop-Release\package"\r
 #endif\r
+#ifndef source_dir\r
+  #define source_dir "."\r
+#endif\r
 \r
 [Setup]\r
 ; NOTE: The value of AppId uniquely identifies this application.\r
@@ -17,7 +20,7 @@
 ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)\r
 AppId={{1B8FE958-A304-4902-BF7A-4E2F0F5B7017}\r
 AppName=GPSBabel\r
-AppVerName=GPSBabel @PACKAGE_VERSION@@PACKAGE_RELEASE@\r
+AppVerName=GPSBabel @GB.VERSION@@GB.PACKAGE_RELEASE@\r
 AppPublisher=GPSBabel\r
 AppPublisherURL=https://www.gpsbabel.org\r
 AppSupportURL=https://www.gpsbabel.org\r
@@ -27,11 +30,12 @@ ArchitecturesInstallIn64BitMode=x64
 DefaultDirName={pf}\GPSBabel\r
 DefaultGroupName=GPSBabel\r
 OutputDir=release\r
-OutputBaseFilename=GPSBabel-@PACKAGE_VERSION@@PACKAGE_RELEASE@-Setup\r
-OutputManifestFile=GPSBabel-@PACKAGE_VERSION@@PACKAGE_RELEASE@-Manifest.txt\r
+OutputBaseFilename=GPSBabel-@GB.VERSION@@GB.PACKAGE_RELEASE@-Setup\r
+OutputManifestFile=GPSBabel-@GB.VERSION@@GB.PACKAGE_RELEASE@-Manifest.txt\r
 SetupIconFile=images\babel2.ico\r
 Compression=lzma\r
 SolidCompression=yes\r
+SourceDir="{#source_dir}"\r
 LicenseFile=COPYING.txt\r
 \r
 [Languages]\r
index 4ffb4c72aa3661c4adbac81a4fbb87c584ca49da..81c2b78c08b5c762f87f816de4e0b77f296a3c58 100644 (file)
@@ -10,6 +10,9 @@
 #ifndef package_dir\r
   #define package_dir \"..\\build-app-Desktop-Release\\package\"\r
 #endif\r
+#ifndef source_dir\r
+  #define source_dir "."\r
+#endif\r
 \r
 [Setup]\r
 ; NOTE: The value of AppId uniquely identifies this application.\r
@@ -17,7 +20,7 @@
 ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)\r
 AppId={{1B8FE958-A304-4902-BF7A-4E2F0F5B7017}\r
 AppName=GPSBabel\r
-AppVerName=GPSBabel $${VERSION}$${GB.PACKAGE_RELEASE}\r
+AppVerName=GPSBabel $${GB.VERSION}$${GB.PACKAGE_RELEASE}\r
 AppPublisher=GPSBabel\r
 AppPublisherURL=https://www.gpsbabel.org\r
 AppSupportURL=https://www.gpsbabel.org\r
@@ -27,11 +30,12 @@ ArchitecturesInstallIn64BitMode=x64
 DefaultDirName={pf}\\GPSBabel\r
 DefaultGroupName=GPSBabel\r
 OutputDir=release\r
-OutputBaseFilename=GPSBabel-$${VERSION}$${GB.PACKAGE_RELEASE}-Setup\r
-OutputManifestFile=GPSBabel-$${VERSION}$${GB.PACKAGE_RELEASE}-Manifest.txt\r
+OutputBaseFilename=GPSBabel-$${GB.VERSION}$${GB.PACKAGE_RELEASE}-Setup\r
+OutputManifestFile=GPSBabel-$${GB.VERSION}$${GB.PACKAGE_RELEASE}-Manifest.txt\r
 SetupIconFile=images\\babel2.ico\r
 Compression=lzma\r
 SolidCompression=yes\r
+SourceDir=\"{#source_dir}\"\r
 LicenseFile=COPYING.txt\r
 \r
 [Languages]\r
index 2affa3dd45376958b4db58044c22514502e0f57e..b17f67270729b0820732bcbe4a61babfdf7786ff 100644 (file)
@@ -38,7 +38,7 @@
 #include <QtXml/QDomElement>                // for QDomElement
 #include <QtXml/QDomNode>                   // for QDomNode
 #include <QtXml/QDomNodeList>               // for QDomNodeList
-#include "../gbversion.h"                   // for VERSION
+#include "gbversion.h"                      // for VERSION
 #include "babeldata.h"                      // for BabelData
 #include "format.h"                         // for Format
 
diff --git a/testo b/testo
index b4ff2c5023c176d51b72811e7df41c6fd4f55ec7..7ce64da08950fb2ce19e32eb5bbdceaa46ab5a4c 100755 (executable)
--- a/testo
+++ b/testo
@@ -11,6 +11,15 @@ export MALLOC_CHECK_
 LC_ALL=en_US.UTF-8
 export LC_ALL
 
+while :
+do
+  case "$1" in
+  -p) PNAME=$2; shift 2;;
+  -v) VALGRIND=$2; shift 2;;
+  *) break;;
+  esac
+done
+
 BASEPATH=`dirname $0`
 PNAME=${PNAME:-${BASEPATH}/gpsbabel}
 DIFF=${DIFF:-diff}
@@ -22,9 +31,6 @@ else
        OD=${OD:-od -Ax -txC -v}
 fi
 XMLWF=xmlwf
-# set up a variable so we can skip extra tests when running valgrind
-echo "${PNAME}" | grep -q valgrind
-RUNNINGVALGRIND=$?
 
 TMPDIR=${GBTEMP:-/tmp}/gpsbabel.$$
 mkdir -p $TMPDIR
@@ -84,17 +90,17 @@ sort_and_compare()
 
 gpsbabel()
 {
-       ${PNAME} "$@" || {
-               echo "$PNAME returned error $?"
-               echo "($PNAME $@)"
-               errorcount=`expr $errorcount + 1`
-               #exit 1
      }
+       ${VALGRIND} "${PNAME}" "$@" || {
+       echo "$PNAME returned error $?"
+       echo "($PNAME $@)"
+       errorcount=`expr $errorcount + 1`
+       #exit 1
+ }
 }
 
 utf8bomcheck()
 {
-  if [ ${RUNNINGVALGRIND} -ne  0 ]; then
+  if [ -z "${VALGRIND}" ]; then
     if [ "$(dd if=$1 bs=1 count=3 2>/dev/null)" = $'\xef\xbb\xbf' ]; then
       echo "ERROR: UTF-8 BOM found in $1"
       errorcount=`expr $errorcount + 1`
@@ -104,7 +110,7 @@ utf8bomcheck()
 
 xmlwfcheck()
 {
-  if [ ${RUNNINGVALGRIND} -ne 0 ]; then
+  if [ -z "${VALGRIND}" ]; then
     if which ${XMLWF} >/dev/null 2>&1; then
       # xmlwf is a bit lame, exit status is always 0
       rm -f ${TMPDIR}/xmlwf.out
@@ -158,7 +164,7 @@ fi
 #cp LineStyles.gpx.badchar ${TMPDIR}/bad.gpx
 XMLS=$(find ${TMPDIR} -name "*.gpx" -o -name "*.kml")
 
-if [ ${RUNNINGVALGRIND} -ne  0 ]; then
+if [ -z "${VALGRIND}" ]; then
   echo "Running UTF-8 BOM test"
   for i in ${XMLS}
   do
@@ -166,7 +172,7 @@ if [ ${RUNNINGVALGRIND} -ne  0 ]; then
   done
 fi
 
-if [ ${RUNNINGVALGRIND} -ne  0 ]; then
+if [ -z "${VALGRIND}" ]; then
   if which ${XMLWF} >/dev/null 2>&1; then
     echo "Running well-formed XML test"
     for i in ${XMLS}
index 539b164787199c29a2573058447cbb5503a9c32a..9d76183ddfeb0f65ef7a3985fad96c90c7452f74 100644 (file)
@@ -6,7 +6,7 @@ rm -f ${TMPDIR}/discard*
 
 # gpx file with points with missing timestamps (has 4 trkpts, 2 duplicate times, 1 missing time, expect merge to output 2 valid trkpts)
 # expecting this to fail during a standard -x track,merge so call directly rather than via gpsbabel function
-${PNAME} -t -i gpx -f ${REFERENCE}/track/trackfilter_discard.gpx -x track,merge -o csv -F - 2> ${TMPDIR}/discard.err && {
+${VALGRIND} "${PNAME}" -t -i gpx -f ${REFERENCE}/track/trackfilter_discard.gpx -x track,merge -o csv -F - 2> ${TMPDIR}/discard.err && {
          echo "$PNAME succeeded! (it shouldn't have with this input...)"
 }
 # check error message is what we expected
index 64b8f3a4b7e6ab76b3bc8ceaf0c3df326ab83a90..506e7f75490696bc28838c816567cbf3120afb61 100644 (file)
@@ -2,7 +2,7 @@ gpsbabel -i gpx -f ${REFERENCE}/basecamp.gpx -x validate,debug > /dev/null 2> ${
 compare ${REFERENCE}/validate_debug.log ${TMPDIR}/validate_debug.log
 
 # expecting this to fail so call directly rather than via gpsbabel function
-${PNAME} -i gpx -f ${REFERENCE}/empty.gpx -x validate,checkempty > /dev/null 2> ${TMPDIR}/validate_empty.log && {
+${VALGRIND} "${PNAME}" -i gpx -f ${REFERENCE}/empty.gpx -x validate,checkempty > /dev/null 2> ${TMPDIR}/validate_empty.log && {
   echo "${PNAME} succeeded! (it shouldn't have with this input...)"
 }
 compare ${REFERENCE}/validate_empty.log ${TMPDIR}/validate_empty.log
index 94f69450da78696f851025219d7f571489b36b2b..b57df31810bc928589d038d74a27cd5c632add8b 100644 (file)
@@ -12,7 +12,7 @@ compare ${REFERENCE}/xol-sample.gpx ${TMPDIR}/xol-sample.gpx
 # check xmlgeneric can detect no input file
 # we expect this to fail
 rm -f ${TMPDIR}/xol-sample_si.gpx
-${PNAME} -i xol -f ${REFERENCE}/doesnotexist -o gpx -F ${TMPDIR}/xol-sample_si.gpx 2> ${TMPDIR}/nonexistent.err && {
+${VALGRIND} "${PNAME}" -i xol -f ${REFERENCE}/doesnotexist -o gpx -F ${TMPDIR}/xol-sample_si.gpx 2> ${TMPDIR}/nonexistent.err && {
          echo "${PNAME} succeeded! (it shouldn't have with this input...)"
 }
 # check error message is what we expected.
index 9ceead247362c71c31ca06b5ba7211efe8e79840..9b2452f41943b352f4b459ec9355d98aa8fc225f 100644 (file)
@@ -1 +1,2 @@
 /mkcapabilities
+/make_gpsbabel_org_wrapper.sh
diff --git a/tools/build_and_test_cmake b/tools/build_and_test_cmake
new file mode 100755 (executable)
index 0000000..717e91d
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash -ex
+#
+# this script is triggered by SCM changes and is run on the build server.
+# output is conditionally mailed to gpsbabel-code.
+#
+# echo some system info to log
+uname -a
+if [ -e /etc/system-release ]; then
+       cat /etc/system-release
+fi
+if [ -e /etc/os-release ]; then
+       cat /etc/os-release
+fi
+git --no-pager log -n 1
+# build and test keeping output within the pwd.
+export GBTEMP=$(pwd)/gbtemp
+mkdir -p $GBTEMP
+cmake . -G Ninja -DCMAKE_BUILD_TYPE=Release -DWEB=$(pwd)/gpsbabel_docdir
+# As of 2018-10, all the virtualized travis build images are two cores per:
+# https://docs.travis-ci.com/user/reference/overview/
+# We'll be slightly abusive on CPU knowing that I/O is virtualized.
+#make toolinfo
+cmake --build . --target clean
+cmake --build .
+cmake --build . --target gpsbabel.html
+cmake --build . --target gpsbabel.pdf
+cmake --build . --target gpsbabel.org
+cmake --build . --target check
+#make -j 3 unix-gui
+# FIXME: use hierarchical build
+pushd gui
+cmake . -G Ninja
+cmake --build .
+popd
+# test for mangled encoding of command line arguments
+./test_encoding_latin1
+./test_encoding_utf8
+#make torture
+cmake --build . --target check-vtesto
+# eat the verbose output from test-all, including crash.output
+# this is a bit risky, if test-all generates an error we won't see what happened.
+echo "test-all in progress... (read/write test between all possible formats)"
+(LIBC_FATAL_STDERR_=1; export LIBC_FATAL_STDERR_; ./test-all -s -r reference/expertgps.gpx >/dev/null 2>&1)
+# summarize the test-all results, and generate an error if a fatal error was
+# detected by test-all.
+./test-all -J
diff --git a/tools/make_gpsbabel_org_wrapper.sh.in b/tools/make_gpsbabel_org_wrapper.sh.in
new file mode 100755 (executable)
index 0000000..fcf2b06
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+
+web=${WEB:-@WEB@}
+"@CMAKE_SOURCE_DIR@/tools/make_gpsbabel_org.sh" "${web}" "@DOCVERSION@"
index 7c546623050bcd40973fb855519e15df5f357d69..32e8a0f5f97c400833be7d35e60a5a6c712df80f 100755 (executable)
@@ -108,8 +108,7 @@ Copy-Item "$($gui_build_dir)\release\GPSBabelFE.exe" "$($gui_build_dir)\package\
 & "$($windeployqt)" --verbose 1 --plugindir package\plugins package\GPSBabelFE.exe package\GPSBabel.exe\r
 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }\r
 if ($buildinstaller -eq "true") {\r
-    Set-Location "$($gpsbabel_src_dir)\gui"\r
-    & "$($iscc)" /Dpackage_dir="$($gui_build_dir)\package" setup.iss\r
+    & "$($iscc)" /Dpackage_dir="$($gui_build_dir)\package" /Dsource_dir="$($gpsbabel_src_dir)\gui" setup.iss\r
     if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }\r
 }\r
 Set-Location "$($gpsbabel_src_dir)"\r
diff --git a/vtesto b/vtesto
index d20f84deca60db481fe0738f377cbeffa5cb2411..0debc413db217659d72c56c990c8bd48a4bf1881 100755 (executable)
--- a/vtesto
+++ b/vtesto
@@ -22,12 +22,12 @@ BASEPATH=`dirname $0`
 # valgrind 3.11.0 has this problem with Qt 5.12.1.
 # It is unknown if 3.12.0 has this problem with Qt 5.12.1.
 # valgrind 3.13.0 does not have this problem with Qt 5.12.1.
-# valgrind 3.11.0 is find with Qt 5.9.7.
+# valgrind 3.11.0 is fine with Qt 5.9.7.
 # vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF2 0xB9 0x1 0x0 0x0 0x0
 vgmajor=$(valgrind --version| cut -d- -f 2 | cut -d. -f 1)
 vgminor=$(valgrind --version| cut -d- -f 2 | cut -d. -f 2)
 if [ ${vgmajor} -lt 3 ]; then
-  vg_vesion_warning
+  vg_version_warning
 fi
 if [ ${vgmajor} -eq 3 ] ; then
   if [ ${vgminor} -le 12 ]; then
@@ -35,26 +35,28 @@ if [ ${vgmajor} -eq 3 ] ; then
   fi
 fi
 
-# newer versons of Qt, e.g. 5.12.x, use a JIT compiler for QRegularExpression.
+# newer versions of Qt, e.g. 5.12.x, use a JIT compiler for QRegularExpression.
 # JITs use of self-modifying code can confuse valgrind.
 # We disable JIT with this environmental variable to keep valgrind happy.
 # https://doc.qt.io/qt-5/qregularexpression.html#debugging-code-that-uses-qregularexpression
 export QT_ENABLE_REGEXP_JIT=0
 
-while getopts "lj:" opt; do
+while getopts "lj:p:" opt; do
   case $opt in
     l) OPTS="--leak-check=full --show-reachable=yes --num-callers=24 --suppressions=${BASEPATH}/gpsbabel.supp" ; QUIET="";;
     j) LOG=$OPTARG;;
+    p) PNAME="$OPTARG";;
   esac
 done
 shift $(($OPTIND -1))
+PNAME=${PNAME:-./gpsbabel}
 
 if [ "x$LOG" = "x" ]; then
-  PNAME="valgrind $OPTS --error-exitcode=125 $QUIET            ./gpsbabel" ${BASEPATH}/testo $*
+  ${BASEPATH}/testo -v "valgrind $OPTS --error-exitcode=125 $QUIET"            -p "$PNAME" $*
 else
 # By default valgrind output goes to file descriptor 2, stderr.
 # Some of our tests redirect file descriptor 2 to a file and compare it to an expected result.
 # These compares will fail if valgrind sends output to file descriptor 2.
 # This option avoids those valgrind induced miscompares by using an alternate file descriptor.
-  PNAME="valgrind $OPTS --error-exitcode=125 $QUIET --log-fd=3 ./gpsbabel" ${BASEPATH}/testo $* 3>$LOG
+  ${BASEPATH}/testo -v "valgrind $OPTS --error-exitcode=125 $QUIET --log-fd=3" -p "$PNAME" $* 3>$LOG
 fi
index 003e27ae0fce00491730d791907dd4020455ec3d..4b660c4d9e9a4a2313272ed733f0cd152e482af4 100644 (file)
@@ -1,5 +1,5 @@
 #include <winver.h>
-#include "../gbversion.h"
+#include "gbversion.h"
 
 IDI_ICON1               ICON                    "gpsbabel.ico"